<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>医院诊疗系统</title>
  <link rel="stylesheet" href="./css/layui.css">
  <script src="./layui.js"></script>
  <script src="./js/jquery-3.5.1.js"></script>

</head>
<body>
    <div class="layui-layout layui-layout-admin">
      <!-- 头部区域（可配合layui 已有的水平导航） -->
      <div class="layui-header">
          <div class="layui-logo layui-hide-xs layui-bg-black">医院诊疗系统</div>
          
          <ul class="layui-nav layui-layout-left">
          <!-- 移动端显示 -->
          <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
              <i class="layui-icon layui-icon-spread-left"></i>
          </li>
          
          <li class="layui-nav-item layui-hide-xs"><a href="doctor_pending.html">门诊管理</a></li>
          <li class="layui-nav-item layui-hide-xs layui-this"><a href="medical_card.html">费用管理</a></li>
          <li class="layui-nav-item layui-hide-xs"><a href="drug_in_storage.html">药库管理</a></li>
          <li class="layui-nav-item layui-hide-xs"><a href="administrator.html">管理员</a></li>
         
        </ul>
    
    
    
        <!-- 右上角导航栏 -->
        <ul class="layui-nav layui-layout-right">
           
          <li class="layui-nav-item layui-hide layui-show-md-inline-block">
            <a href="javascript:;">
              <img src="image/gly.jpg" class="layui-nav-img">
              管理员
            </a>
            <dl class="layui-nav-child">
              <dd><a href="">修改密码</a></dd>
              <dd><a id="edit">编辑信息</a></dd>
              <dd><a href="">退出登录</a></dd>
            </dl>
          </li>
          
        </ul>
        <!-- 右上角导航栏 -->
        
      </div>
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <div class="layui-side layui-bg-black">
          <div class="layui-side-scroll">
          
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
              <li class="layui-nav-item ">
                <a class="" href="medical_card.html">医疗卡管理</a>
                
              </li>
              <li class="layui-nav-item ">
                <a href="out_patient_charges.html" >门诊收费</a>
              </li>
              <li class="layui-nav-item ">
                <a href="return_premium.html">门诊退费</a>
              </li>
              <li class="layui-nav-item layui-nav-itemed">
                <a href="javascript:;" class="layui-this">费用日结</a>
              </li>
            </ul>

    
          </div>
      </div>
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
    
      <!-- 内容主体区域 -->
      <div class="layui-body" style="padding: 15px;">
        <!-- 面包屑 -->

        <div style=" padding: 15px;  background-color: #ffffff; border: solid #eeeeee 1px; box-shadow: inset 0 0 10px rgba(255, 255, 227, 0.925);">
          <fieldset class="layui-elem-field layui-field-title" style="margin: 0; border-top: none; padding: 0;height: 25px;line-height: 25px;">
            <span class="layui-breadcrumb" >
                <a href="/">费用管理</a>
                <a><cite>费用日结</cite></a>
            </span>
          </fieldset>
        </div>

        <!-- 面包屑 -->
        <blockquote class="layui-elem-quote" style="margin-top: 10px;">
          日结统计
        </blockquote>

        <!-- 日统计 -->
        <div style="margin: 5px 20px; ">
          <hr>
          <div style="padding: 5px;  background-color: #fafafa;">
              <div class="layui-row" style="text-align: center;">
                  
                  <div class="layui-col-xs4 layui-show-md-inline" style="padding: 5px;">
                      <span class="">日总收费</span>
                  </div>
                  <div class="layui-col-xs4 layui-show-md-inline" style="padding: 5px;">
                      <span class="">日总退费</span>
                  </div>
                  <div class="layui-col-xs4 layui-show-md-inline" style="padding: 5px;">
                      <span class="">日总收入</span>
                  </div>
                  
              </div>
          </div>
          <hr>
          <div style="padding: 5px;  background-color: #fdfdfd;">
              <div class="layui-row" style="text-align: center;">
                  <div class="layui-col-xs4 layui-show-md-inline" style="padding: 5px;">
                      <span id="Charge"></span>
                  </div>
                  <div class="layui-col-xs4 layui-show-md-inline" style="padding: 5px;">
                      <span id="Refund"></span>
                  </div>
                  <div class="layui-col-xs4 layui-show-md-inline" style="padding: 5px;">
                    <span id="Total"></span>
                </div>
              </div>
          </div>
          <hr>
          
          
          
          
      </div>
        <!-- 日统计 -->

          <div class="demo">
              <div class="layui-inline">
                  <input class="layui-input" name="card" id="card" placeholder="医疗卡号" >
              </div>
              <button class="layui-btn" data-type="reload">搜索</button>
          </div>
        
              <!-- 表格头部 -->
          <table class="layui-hide" id="test" lay-filter="test"></table>
 
     
</div>
  
  <!-- 主体 -->
  
</div>





    <!-- // 表格处理 -->

    
                  
              
    
    <script>
      var a;
    layui.use('table', function(){
      var table = layui.table;
      
      table.render({
        elem: '#test',
        url:'/charge/selectDaily',   //数据来源接口
        id: 'allDailyTable'
        ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
        ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
          title: '提示'
          ,layEvent: 'LAYTABLE_TIPS'
          ,icon: 'layui-icon-tips'
        }]
        ,totalRow: true
        ,title: '用户数据表'
        ,cols: [
          [  //表头
        {type: 'checkbox', fixed: 'left'}
          ,{field: 'br_card', title: '诊疗卡号', width:130, fixed: 'left', align:'center',unresize: true, sort: true, totalRowText: '合计'}
          ,{field: 'yh_name', title: '姓名', width:80,align:'center' }
              ,{field: 'br_age', title: '年龄', width:80,align:'center' }
              ,{field: 'yh_phone', title: '手机', width:80,align:'center' }
          ,{field: 'bl_diag', title: '诊断', width: 170, align:'center'}
          ,{field: 'charge', title: '收费', width:80, align:'center',totalRow: true}
          ,{field: 'refund', title: '退费', width: 120, align:'center',totalRow: true }
        ]
      ]
        ,page: true
          ,parseData: function (res) {
              return {
                  'code': 0,
                  'msg': '',
                  'count': res.length,
                  'data': res
              }
          }
          ,done:function (res,curr,count){
              var Charge=0;
              var Refund=0;
              var Total=0;
              for (var i = 0; i < res.data.length; i++) {
                  console.log(res.data[i])
                  Charge += parseFloat(res.data[i]['charge']);
                  Refund += parseFloat(res.data[i]['refund']);
                  Total += parseFloat(res.data[i]['charge']) - parseFloat(res.data[i]['refund']);
              }
            $("#Charge").text(Charge);
            $("#Refund").text(Refund);
            $("#Total").text(Total);
          }
      });
        var $ = layui.$, active = {
            reload:function (){
                var card = $('#card');
                var index = layer.msg('查询中，请稍候...',{icon:16,time:false,shade:0});
                setTimeout(function (){
                    table.reload('allDailyTable',{
                        page:{
                            curr:1
                        }
                        ,where:{
                            card:card.val()
                        }
                    });
                    layer.close(index);
                },800);
            }
        };
        $('.demo .layui-btn').on('click',function (){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });


    });
    
    </script>


    <!-- // 表格处理 -->



    


<!-- 修改信息事件 -->
<script>
  $("#edit").on('click',function(e){
    //打开窗口
    layer.open({
            type: 2,
            area: ['1000px', '600px'],
            fixed: false, //不固定
            maxmin: true,
            title:"个人信息",
            content: 'edit_information.html'
            // 3.父传子值
            //  success:function(layero, index){
            //       //关键在这，调用子的iframe的方法，进行传参,前两行固定写法
            //       var body = layer.getChildFrame('body', index);
            //       var iframeWin = window[layero.find('iframe')[0]['name']];
            //       var div=$(obj).text();
            //       iframeWin.childIframe(div);    //看这
            //   }
      });
  });

</script>


</body>
</html>